package cn.goktech.service.imp;

import cn.goktech.dao.DBInfoDAO;
import cn.goktech.entity.Table;
import cn.goktech.properties.DBType2JavaType;
import cn.goktech.service.IDBInfo;
import cn.goktech.util.ClassHandUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @ClassName DBInfoImp
 * @Discription TODO
 * @Author Carter
 * @Date 2021/4/18 11:07
 * @Version 1.0
 **/
@Service
public class DBInfoImp implements IDBInfo {

    @Autowired
    private DBInfoDAO dbInfoDAO;
    @Autowired
    private ClassHandUtil classHandUtil;
    @Override
    public List<Map<String,String>> getAllDataBase() {
       return dbInfoDAO.getAllDataBase();
    }

    @Override
    public List<Table> getTableByDBName(String dbName) {
        List<Table> tableByDBName = dbInfoDAO.getTableByDBName(dbName);
        return classHandUtil.doTypeChange(tableByDBName);
    }
}
